package com.wang.learn.cloudkafka.consumer;/*
 * ******************************************************************************
 *
 *                       Woodare PROPRIETARY INFORMATION
 *
 *           The information contained herein is proprietary to Woodare
 *            and shall not be reproduced or disclosed in whole or in part
 *                     or used for any design or manufacture
 *               without direct written authorization from FengDa.
 *
 *             Copyright (c) 2021 by Woodare.  All rights reserved.
 *
 * ******************************************************************************
 */

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * ClassName KafkaConsumer
 *
 * @author wang
 * Date 2021/9/16 15:32
 */
@Component
public class KafkaConsumer {
    /**
     * 消费监听
     */
    @KafkaListener(topics = {"test1"}, groupId = "test-consumer-group")
    public void onMessage1(ConsumerRecord<?, ?> record){
        // 消费的哪个topic、partition的消息,打印出消息内容
        System.out.println("简单消费："+record.topic()+"-"+record.partition()+"-"+record.value());
    }

}
